/*
	Copyright [2012] [Reimar Klammer / David Laubichler]

	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at

		http://www.apache.org/licenses/LICENSE-2.0

	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
*/


#ifndef _ENVIRONMENT_H // wird definiert, damit Header-File nur einmal eingebunden wird
#define _ENVIRONMENT_H

#include "antsimulationbaseitem.h"
#include "Field.h"
#include <list>

class Environment //:	public AntSimulationBaseItem kein BAseitem Mehr
{
private:
	std::list<AntSimulationBaseItem*> m_Allitems;
	std::list<Field*> m_Fields;
	std::list<Field*>::iterator m_FieldsIterator;
	std::list<AntSimulationBaseItem*>::iterator m_AllitemsIterator;
	int m_Rows,m_Columns,m_CountOfAnts,m_CountOfFood,m_CountOfHives;
	bool m_ParametersSet, m_ItemsCreated;
	void CreateItems();
	Field* m_FirstField;
	static Environment* m_Instance;
	
protected:
	Environment(void);

public:
	~Environment(void);
	void Simulate();
	// Clears all information
	void Reset();
	void SimulateStep();
	void SetParameters(int rows, int columns, int countOfAnts, int countOfFood, int countOfHives);
	//werden wir nicht brauchen wenn wir nicht mit Threads arbeiten.
	void StopSimulation();
	static Environment* Instance();
	void AddItem(AntSimulationBaseItem*);
	void RemoveItem(AntSimulationBaseItem*);
	void AddField(Field*);
	void RemoveField(Field*);
};

#endif

